<template>
  <div style="width:100%;height:100%;" v-loading="loading">
    <el-dialog title="订单详情" :close-on-click-modal="false" :visible.sync="orderDialog" width="45%" @close="closeHandler">
      <el-form :model="order" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      
        <el-form-item label="订单编号" prop="orderNumb">
          <el-input v-model="order.orderNumb" disabled></el-input>
        </el-form-item>
        <el-form-item label="电话" prop="mobile">
          <el-input v-model="order.mobile"></el-input>
        </el-form-item>
        <el-form-item label="门店名称">
          <el-input v-model="order.storeName" ></el-input>
        </el-form-item>
         <el-form-item label="服务">
          <el-input v-model="order.serviceName" ></el-input>
        </el-form-item>
        <el-form-item label="宠物名称">
          <el-input v-model="order.petName" ></el-input>
        </el-form-item>
        <el-form-item label="订单状态">
              <div v-if="order.status==1">进行中</div>
            <div v-if="order.status==2">成功</div>
            <div v-if="order.status==3">失败</div>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="closeHandler()">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {storeSaveUrl} from '@/utils/common'
export default {
  props: {
    orderDialog: {
      type: Boolean,
      default: false
    },
    popOrder: {
      type: Object,
      default: null
    }
  },
  watch: {
    popOrder:function(n,o){
        console.log("原数据:{}",o);
        this.order = n;
    }
  },
  data() {
   
    return {
      loading: false,
      order: {},
      rules: {
        mobile: { required: true, message: "请输入电话", trigger: "blur" },
        storeName: { required: true, message: "请输入商户名称", trigger: "blur" },
      },
    }
  },
  mounted() {
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.saveMerchant();
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    changeIcon(image){
      this.merchant.storePhoto = image
      this.storePhoto="";
    },
    changeCertificateIcon(image){
      this.merchant.certificate = image
    },
    changeIcons(image){
      this.merchant.indoorPhoto= image
      this.indoorPhoto="";
    },
    saveMerchant() {
      this.loading = true;
      this.merchant.openingHours = this.timeRangeList.join(",")
      this.axios
        .post(storeSaveUrl, this.merchant)
        .then(res => {
          if (res.data.status == "SUCCESS") {
            this.loading = false;
            this.merchant={};
            this.$emit("close");
            this.$message.success(res.data.result);
          } else {
            this.loading = false;
            this.$message.error(res.data.result);
          }
        })
        .catch(response => {
          this.loading = false;
          console.log("response - " + response);
          this.$message.error("数据保存异常失败");
        });
    },
    closeHandler: function () {
      this.popOrder = {};
      this.$emit("close");
    }
  }
};
</script>

<style lang="less" scoped>
.upload-demo{
    text-align: left;
  }
  .upload-box{
    
    .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
  /deep/.el-form-item__content{
    margin-left: 0!important;
  }
  
  }
</style>
